package com.baidu.mapapi;

import android.os.Bundle;
import android.util.Log;
import java.io.UnsupportedEncodingException;

public class MKSearch
{
  public static final int EBUS_NO_SUBWAY = 6;
  public static final int EBUS_TIME_FIRST = 3;
  public static final int EBUS_TRANSFER_FIRST = 4;
  public static final int EBUS_WALK_FIRST = 5;
  public static final int ECAR_DIS_FIRST = 1;
  public static final int ECAR_FEE_FIRST = 2;
  public static final int ECAR_TIME_FIRST = 0;
  public static final int TYPE_AREA_MULTI_POI_LIST = 45;
  public static final int TYPE_AREA_POI_LIST = 21;
  public static final int TYPE_CITY_LIST = 7;
  public static final int TYPE_POI_LIST = 11;
  private static int b = 10;
  private Bundle a = null;
  private int c = 3;
  private int d = 0;

  public static int getPoiPageCapacity()
  {
    return b;
  }

  public static void setPoiPageCapacity(int paramInt)
  {
    if ((paramInt > 0) && (paramInt <= 50))
      b = paramInt;
  }

  public int busLineSearch(String paramString1, String paramString2)
  {
    if ((paramString1 == null) || (paramString1.length() <= 0) || (paramString2 == null) || (paramString2.length() <= 0));
    while (true)
    {
      return -1;
      if (paramString1.length() > 31)
        continue;
      if (this.a == null)
      {
        this.a = new Bundle();
        label51: this.a.putInt("act", 11010203);
        this.a.putInt("opt", 11010105);
      }
      try
      {
        this.a.putByteArray("city", paramString1.getBytes("gb2312"));
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException1)
      {
        try
        {
          while (true)
          {
            this.a.putByteArray("busid", paramString2.getBytes("gb2312"));
            if (Mj.sendBundle(this.a) == 0)
              break;
            return 0;
            this.a.clear();
            break label51;
            localUnsupportedEncodingException1 = localUnsupportedEncodingException1;
            Log.d("MKSearch busLineSearch:", "busLine city error!!");
            Log.d("MKSearch busLineSearch:", localUnsupportedEncodingException1.getMessage());
          }
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException2)
        {
          while (true)
          {
            Log.d("MKSearch busLineSearch:", "busLine name error!!");
            Log.d("MKSearch busLineSearch:", localUnsupportedEncodingException2.getMessage());
          }
        }
      }
    }
  }

  public int drivingSearch(String paramString1, MKPlanNode paramMKPlanNode1, String paramString2, MKPlanNode paramMKPlanNode2)
  {
    int i;
    if ((paramMKPlanNode1 == null) || (paramMKPlanNode2 == null))
    {
      i = -1;
      return i;
    }
    if (this.a == null)
    {
      this.a = new Bundle();
      this.a.putInt("act", 11020203);
      this.a.putInt("opt", 11020102);
      if (paramMKPlanNode1.pt == null)
        break label443;
      this.a.putInt("start_x", paramMKPlanNode1.pt.getLongitudeE6());
      this.a.putInt("start_y", paramMKPlanNode1.pt.getLatitudeE6());
    }
    label405: label443: for (int j = 1; ; j = 0)
    {
      while (true)
      {
        if ((paramMKPlanNode1.name != null) && (paramMKPlanNode1.name.length() <= 99));
        try
        {
          this.a.putByteArray("start_name", paramMKPlanNode1.name.getBytes("gb2312"));
          if ((paramString1 == null) || (paramString1.length() > 31));
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException3)
        {
          try
          {
            this.a.putByteArray("start_city", paramString1.getBytes("gb2312"));
            j = 1;
            if (j != 0)
              break label232;
            return -1;
            this.a.clear();
            break;
            localUnsupportedEncodingException3 = localUnsupportedEncodingException3;
            Log.d("MKSearch drivingSearch:", "translate start name error!!");
            Log.d("MKSearch drivingSearch:", localUnsupportedEncodingException3.getMessage());
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException4)
          {
            while (true)
            {
              Log.d("MKSearch drivingSearch:", "translate start city error!!");
              Log.d("MKSearch drivingSearch:", localUnsupportedEncodingException4.getMessage());
            }
          }
        }
      }
      return -1;
      label232: if (paramMKPlanNode2.pt != null)
      {
        this.a.putInt("end_x", paramMKPlanNode2.pt.getLongitudeE6());
        this.a.putInt("end_y", paramMKPlanNode2.pt.getLatitudeE6());
      }
      for (int k = 1; ; k = 0)
      {
        if ((paramMKPlanNode2.name != null) && (paramMKPlanNode2.name.length() <= 99));
        try
        {
          this.a.putByteArray("end_name", paramMKPlanNode2.name.getBytes("gb2312"));
          if ((paramString2 == null) || (paramString2.length() > 31));
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException1)
        {
          try
          {
            this.a.putByteArray("end_city", paramString2.getBytes("gb2312"));
            k = 1;
            if (k != 0)
              break label405;
            return -1;
            localUnsupportedEncodingException1 = localUnsupportedEncodingException1;
            Log.d("MKSearch drivingSearch:", "translate end name error!!");
            Log.d("MKSearch drivingSearch:", localUnsupportedEncodingException1.getMessage());
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException2)
          {
            while (true)
            {
              Log.d("MKSearch drivingSearch:", "translate end city error!!");
              Log.d("MKSearch drivingSearch:", localUnsupportedEncodingException2.getMessage());
            }
          }
        }
        return -1;
        this.a.putInt("policy", this.d);
        int m = Mj.sendBundle(this.a);
        i = 0;
        if (m != 0)
          break;
        return -1;
      }
    }
  }

  public int geocode(String paramString1, String paramString2)
  {
    if ((paramString1 == null) || (paramString1.length() == 0) || (paramString1.length() > 99));
    while (true)
    {
      return -1;
      if (this.a == null)
      {
        this.a = new Bundle();
        this.a.putInt("act", 11010203);
        this.a.putInt("opt", 11010112);
        this.a.putString("addr", paramString1);
        if ((paramString2 == null) || (paramString2.length() > 16));
      }
      try
      {
        this.a.putByteArray("city", paramString2.getBytes("gb2312"));
        if (Mj.sendBundle(this.a) == 0)
          continue;
        return 0;
        this.a.clear();
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException)
      {
        while (true)
          localUnsupportedEncodingException.printStackTrace();
      }
    }
  }

  public int goToPoiPage(int paramInt)
  {
    if ((this.a == null) || (!this.a.containsKey("page_num")));
    do
    {
      return -1;
      this.a.putInt("cnt", b);
      this.a.putInt("page_num", paramInt);
    }
    while (Mj.sendBundle(this.a) == 0);
    return 0;
  }

  public boolean init(BMapManager paramBMapManager, MKSearchListener paramMKSearchListener)
  {
    if (paramBMapManager == null);
    do
    {
      return false;
      if (paramMKSearchListener != null)
        paramBMapManager.a.a(paramMKSearchListener);
    }
    while (Mj.initSearchCC() != 1);
    return true;
  }

  public int offlineSearch(int paramInt)
  {
    if (this.a == null)
    {
      this.a = new Bundle();
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010108);
      this.a.putInt("cityid", paramInt);
      if (Mj.i > 180)
        break label97;
      this.a.putInt("uid", 0);
    }
    while (true)
    {
      int i = Mj.sendBundle(this.a);
      int j = 0;
      if (i == 0)
        j = -1;
      return j;
      this.a.clear();
      break;
      label97: this.a.putInt("uid", 1);
    }
  }

  public int poiMultiSearchInbounds(String[] paramArrayOfString, GeoPoint paramGeoPoint1, GeoPoint paramGeoPoint2)
  {
    int i;
    if ((paramArrayOfString == null) || (paramGeoPoint1 == null) || (paramGeoPoint2 == null))
      i = -1;
    label159: int k;
    do
    {
      return i;
      if ((paramArrayOfString.length < 2) || (paramArrayOfString.length > 10))
        return -1;
      StringBuilder localStringBuilder;
      if (this.a == null)
      {
        this.a = new Bundle();
        localStringBuilder = new StringBuilder();
      }
      for (int j = 0; ; j++)
      {
        if (j >= paramArrayOfString.length)
          break label159;
        if (paramArrayOfString[j] == null)
        {
          return -1;
          this.a.clear();
          break;
        }
        String str = paramArrayOfString[j].trim();
        if ((str.length() == 0) || (str.length() > 99) || (str.contains("$$")))
          return -1;
        localStringBuilder.append(str);
        if (j != -1 + paramArrayOfString.length)
          localStringBuilder.append("$$");
      }
      if (localStringBuilder.toString().length() > 99)
        return -1;
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010111);
      this.a.putString("key", localStringBuilder.toString());
      this.a.putInt("page_num", 0);
      this.a.putInt("cnt", b);
      this.a.putInt("start_x", paramGeoPoint1.getLongitudeE6());
      this.a.putInt("start_y", paramGeoPoint1.getLatitudeE6());
      this.a.putInt("end_x", paramGeoPoint2.getLongitudeE6());
      this.a.putInt("end_y", paramGeoPoint2.getLatitudeE6());
      this.a.putInt("key_num", paramArrayOfString.length);
      k = Mj.sendBundle(this.a);
      i = 0;
    }
    while (k != 0);
    return -1;
  }

  public int poiMultiSearchNearBy(String[] paramArrayOfString, GeoPoint paramGeoPoint, int paramInt)
  {
    int i;
    if ((paramGeoPoint == null) || (paramArrayOfString == null))
      i = -1;
    label163: int k;
    do
    {
      return i;
      if (paramInt <= 0)
        return -1;
      if ((paramArrayOfString.length < 2) || (paramArrayOfString.length > 10))
        return -1;
      StringBuilder localStringBuilder;
      if (this.a == null)
      {
        this.a = new Bundle();
        localStringBuilder = new StringBuilder();
      }
      for (int j = 0; ; j++)
      {
        if (j >= paramArrayOfString.length)
          break label163;
        if (paramArrayOfString[j] == null)
        {
          return -1;
          this.a.clear();
          break;
        }
        String str = paramArrayOfString[j].trim();
        if ((str.length() == 0) || (str.length() > 99) || (paramArrayOfString[j].contains("$$")))
          return -1;
        localStringBuilder.append(str);
        if (j != -1 + paramArrayOfString.length)
          localStringBuilder.append("$$");
      }
      if (localStringBuilder.toString().length() > 99)
        return -1;
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010111);
      this.a.putString("key", localStringBuilder.toString());
      this.a.putInt("start_x", paramGeoPoint.getLongitudeE6());
      this.a.putInt("start_y", paramGeoPoint.getLatitudeE6());
      this.a.putInt("radius", paramInt);
      this.a.putInt("page_num", 0);
      this.a.putInt("cnt", b);
      this.a.putInt("key_num", paramArrayOfString.length);
      k = Mj.sendBundle(this.a);
      i = 0;
    }
    while (k != 0);
    return -1;
  }

  public int poiSearchInCity(String paramString1, String paramString2)
  {
    if (paramString2 == null);
    while (true)
    {
      return -1;
      if (paramString1 == null)
        paramString1 = "";
      String str1 = paramString1.trim();
      String str2 = paramString2.trim();
      if ((str1.length() > 16) || (str2.length() == 0) || (str2.length() > 99))
        continue;
      if (this.a == null)
      {
        this.a = new Bundle();
        this.a.putInt("act", 11010203);
        this.a.putInt("opt", 11010101);
      }
      try
      {
        this.a.putByteArray("city", str1.getBytes("gb2312"));
        this.a.putString("key", str2);
        this.a.putInt("page_num", 0);
        this.a.putInt("cnt", b);
        if (Mj.sendBundle(this.a) == 0)
          continue;
        return 0;
        this.a.clear();
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException)
      {
        while (true)
        {
          Log.d("MKSearch poiSearchInCity:", "translate city error!!");
          Log.d("MKSearch poiSearchInCity:", localUnsupportedEncodingException.getMessage());
        }
      }
    }
  }

  public int poiSearchInbounds(String paramString, GeoPoint paramGeoPoint1, GeoPoint paramGeoPoint2)
  {
    if ((paramString == null) || (paramGeoPoint1 == null) || (paramGeoPoint2 == null));
    String str;
    do
    {
      return -1;
      str = paramString.trim();
    }
    while ((str.length() == 0) || (str.length() > 99));
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010104);
      this.a.putString("key", str);
      this.a.putInt("page_num", 0);
      this.a.putInt("cnt", b);
      this.a.putInt("start_x", paramGeoPoint1.getLongitudeE6());
      this.a.putInt("start_y", paramGeoPoint1.getLatitudeE6());
      this.a.putInt("end_x", paramGeoPoint2.getLongitudeE6());
      this.a.putInt("end_y", paramGeoPoint2.getLatitudeE6());
      if (Mj.sendBundle(this.a) == 0)
        break;
      return 0;
      this.a.clear();
    }
  }

  public int poiSearchNearBy(String paramString, GeoPoint paramGeoPoint, int paramInt)
  {
    if ((paramGeoPoint == null) || (paramString == null));
    String str;
    do
    {
      do
        return -1;
      while (paramInt <= 0);
      str = paramString.trim();
    }
    while ((str.length() == 0) || (str.length() > 99));
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010104);
      this.a.putString("key", str);
      this.a.putInt("start_x", paramGeoPoint.getLongitudeE6());
      this.a.putInt("start_y", paramGeoPoint.getLatitudeE6());
      this.a.putInt("radius", paramInt);
      this.a.putInt("page_num", 0);
      this.a.putInt("cnt", b);
      if (Mj.sendBundle(this.a) == 0)
        break;
      return 0;
      this.a.clear();
    }
  }

  public int rGCShareUrlSearch(GeoPoint paramGeoPoint, String paramString1, String paramString2)
  {
    if ((paramString1 == null) || (paramString2 == null) || (paramGeoPoint == null));
    String str1;
    String str2;
    do
    {
      return -1;
      str1 = paramString1.trim();
      str2 = paramString2.trim();
    }
    while ((str1.length() > 99) || (str2.length() > 99));
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010110);
      this.a.putString("key", "");
      this.a.putInt("cnt", b);
      this.a.putInt("page_num", 0);
      this.a.putInt("x", paramGeoPoint.getLongitudeE6());
      this.a.putInt("y", paramGeoPoint.getLatitudeE6());
      this.a.putString("name", str1);
      this.a.putString("addr", str2);
      if (Mj.sendBundle(this.a) == 0)
        break;
      return 0;
      this.a.clear();
    }
  }

  public int reverseGeocode(GeoPoint paramGeoPoint)
  {
    if (paramGeoPoint == null)
      return -1;
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 11010203);
      this.a.putInt("opt", 11010109);
      this.a.putInt("x", paramGeoPoint.getLongitudeE6());
      this.a.putInt("y", paramGeoPoint.getLatitudeE6());
      if (Mj.sendBundle(this.a) == 0)
        break;
      return 0;
      this.a.clear();
    }
  }

  public int setDrivingPolicy(int paramInt)
  {
    if ((paramInt > 2) || (paramInt < 0))
      return -1;
    this.d = paramInt;
    return 0;
  }

  public int setTransitPolicy(int paramInt)
  {
    if ((paramInt > 6) || (paramInt < 3))
      return -1;
    this.c = paramInt;
    return 0;
  }

  public int suggestionSearch(String paramString)
  {
    if (paramString == null);
    String str;
    do
    {
      return -1;
      str = paramString.trim();
    }
    while ((str.length() == 0) || (str.length() > 99));
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 11020301);
      this.a.putInt("opt", 11010107);
      this.a.putString("key", str);
      if (Mj.sendBundle(this.a) == 0)
        break;
      return 0;
      this.a.clear();
    }
  }

  public int transitSearch(String paramString, MKPlanNode paramMKPlanNode1, MKPlanNode paramMKPlanNode2)
  {
    int i;
    if ((paramString == null) || (paramMKPlanNode1 == null) || (paramMKPlanNode2 == null))
      i = -1;
    while (true)
    {
      return i;
      if (paramString.length() > 31)
        return -1;
      if (this.a == null)
      {
        this.a = new Bundle();
        label47: this.a.putInt("act", 11020203);
        this.a.putInt("opt", 11020101);
      }
      try
      {
        this.a.putByteArray("city", paramString.getBytes("gb2312"));
        if (paramMKPlanNode1.pt != null)
        {
          this.a.putInt("start_x", paramMKPlanNode1.pt.getLongitudeE6());
          this.a.putInt("start_y", paramMKPlanNode1.pt.getLatitudeE6());
          j = 1;
          if ((paramMKPlanNode1.name == null) || (paramMKPlanNode1.name.length() > 99));
        }
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException1)
      {
        while (true)
        {
          try
          {
            this.a.putByteArray("start_name", paramMKPlanNode1.name.getBytes("gb2312"));
            j = 1;
            if (j == 0)
            {
              return -1;
              this.a.clear();
              break label47;
              localUnsupportedEncodingException1 = localUnsupportedEncodingException1;
              Log.d("MKSearch transitSearch:", "translate city error!!");
              Log.d("MKSearch transitSearch:", localUnsupportedEncodingException1.getMessage());
            }
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException3)
          {
            Log.d("MKSearch transitSearch:", "translate start name error!!");
            Log.d("MKSearch transitSearch:", localUnsupportedEncodingException3.getMessage());
            continue;
          }
          if (paramMKPlanNode2.pt != null)
          {
            this.a.putInt("end_x", paramMKPlanNode2.pt.getLongitudeE6());
            this.a.putInt("end_y", paramMKPlanNode2.pt.getLatitudeE6());
          }
          for (int k = 1; ; k = 0)
          {
            if ((paramMKPlanNode2.name != null) && (paramMKPlanNode2.name.length() <= 99));
            int m;
            try
            {
              this.a.putByteArray("end_name", paramMKPlanNode2.name.getBytes("gb2312"));
              k = 1;
              if (k == 0)
                return -1;
            }
            catch (UnsupportedEncodingException localUnsupportedEncodingException2)
            {
              while (true)
              {
                Log.d("MKSearch transitSearch:", "translate end name error!!");
                Log.d("MKSearch transitSearch:", localUnsupportedEncodingException2.getMessage());
              }
              this.a.putInt("policy", this.c);
              m = Mj.sendBundle(this.a);
              i = 0;
            }
            if (m != 0)
              break;
            return -1;
          }
          int j = 0;
        }
      }
    }
  }

  public int walkingSearch(String paramString1, MKPlanNode paramMKPlanNode1, String paramString2, MKPlanNode paramMKPlanNode2)
  {
    int i;
    if ((paramMKPlanNode1 == null) || (paramMKPlanNode2 == null))
    {
      i = -1;
      return i;
    }
    if (this.a == null)
    {
      this.a = new Bundle();
      this.a.putInt("act", 11020203);
      this.a.putInt("opt", 11020103);
      if (paramMKPlanNode1.pt == null)
        break label439;
      this.a.putInt("start_x", paramMKPlanNode1.pt.getLongitudeE6());
      this.a.putInt("start_y", paramMKPlanNode1.pt.getLatitudeE6());
    }
    label414: label439: for (int j = 1; ; j = 0)
    {
      while (true)
      {
        if ((paramMKPlanNode1.name != null) && (paramMKPlanNode1.name.length() <= 99));
        try
        {
          this.a.putByteArray("start_name", paramMKPlanNode1.name.getBytes("gb2312"));
          if ((paramString1 == null) || (paramString1.length() > 31));
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException3)
        {
          try
          {
            this.a.putByteArray("start_city", paramString1.getBytes("gb2312"));
            j = 1;
            if (j != 0)
              break label237;
            return -1;
            this.a.clear();
            break;
            localUnsupportedEncodingException3 = localUnsupportedEncodingException3;
            Log.d("MKSearch walkingSearch:", "translate start name error!!");
            Log.d("MKSearch walkingSearch:", localUnsupportedEncodingException3.getMessage());
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException4)
          {
            while (true)
            {
              Log.d("MKSearch walkingSearch:", "translate start city error!!");
              Log.d("MKSearch walkingSearch:", localUnsupportedEncodingException4.getMessage());
            }
          }
        }
      }
      return -1;
      label237: if (paramMKPlanNode2.pt != null)
      {
        this.a.putInt("end_x", paramMKPlanNode2.pt.getLongitudeE6());
        this.a.putInt("end_y", paramMKPlanNode2.pt.getLatitudeE6());
      }
      for (int k = 1; ; k = 0)
      {
        if ((paramMKPlanNode2.name != null) && (paramMKPlanNode2.name.length() <= 99));
        try
        {
          this.a.putByteArray("end_name", paramMKPlanNode2.name.getBytes("gb2312"));
          if ((paramString2 == null) || (paramString2.length() > 31));
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException1)
        {
          try
          {
            this.a.putByteArray("end_city", paramString2.getBytes("gb2312"));
            k = 1;
            if (k != 0)
              break label414;
            return -1;
            localUnsupportedEncodingException1 = localUnsupportedEncodingException1;
            Log.d("MKSearch walkingSearch:", "translate end name error!!");
            Log.d("MKSearch walkingSearch:", localUnsupportedEncodingException1.getMessage());
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException2)
          {
            while (true)
            {
              Log.d("MKSearch walkingSearch:", "translate end city error!!");
              Log.d("MKSearch walkingSearch:", localUnsupportedEncodingException2.getMessage());
            }
          }
        }
        return -1;
        int m = Mj.sendBundle(this.a);
        i = 0;
        if (m != 0)
          break;
        return -1;
      }
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.baidu.mapapi.MKSearch
 * JD-Core Version:    0.6.2
 */